#ifndef _FV_H_
#define _FV_H_

#include <stdbool.h>
#include <stdint.h>
#include "fv_key.h"

extern struct fv_key __fv_key;


struct fv_string {
    char *str;
    uint32_t bg, fg;
};

struct fv_border {
    uint8_t which;
    uint32_t points[4];
    uint32_t lines[4];
    uint32_t bg, fg;
};

struct __fv_super {
    uint8_t type;
    int id;
    int x, y;
    int w, h;
    void (*draw)(void *ctx);
};


struct fv_block {
    struct __fv_super obj;
    struct fv_string title;
    struct fv_border border;
};


/* layout */
struct fv_box {
    bool deadloop;
    uint8_t orientation;
    int id;
    int x, y, w, h;
    float ratio;
    int min, max;
    int nbox; // nbox
    struct fv_box *box; // inner box
    struct __fv_super *widget_obj;
    void (*set_widget)(struct fv_box *b, struct __fv_super *obj);
};

/* fv init */
typedef struct fv_init {
    int w, h;
    struct fv_box box;
    void (*on_key)(void);
    void (*on_tmsize)(int w, int h);
    int (*loop)(void);
};


/* core */
struct fv_init *fv_init(void);
void fv_exit();

/* layout */

/* widgets */
struct fv_block *fv_block(const char *title);

#endif
